package com.hackintosh.prototype.pattern.west;

import javax.swing.*;
import java.awt.*;

/**
 * @description：用原型模式模拟“孙悟空”复制自己
 * @author：twislyn
 * @date：Created in 2021/05/06
 * @modified By：
 * @version: 1.0
 */
public class ProtoTypeWukong {

    public static void main(String[] args) {
        JFrame jFrame = new JFrame("原型模式测试");
        jFrame.setLayout(new GridLayout(1,2));
        Container container = jFrame.getContentPane();
        SunWukong obj1 = new SunWukong();
        container.add(obj1);
        SunWukong obj2 = (SunWukong) obj1.clone();
        container.add(obj2);
        jFrame.pack();
        jFrame.setVisible(true);
        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}
